package com.xmall.member.utils;

import com.xmall.define.dto.member.DeliveryAddressDto;
import com.xmall.member.define.dto.CartDto;
import com.xmall.member.entity.Cart;
import com.xmall.member.entity.DeliveryAddress;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.List;

public interface ConvertUtils {

    /**
     * cart
     */
    @Mapper(componentModel = "spring")
    interface CartModule {
        CartModule INSTANCE = Mappers.getMapper(CartModule.class);

        List<CartDto> toDtoList(List<Cart> cartList);
    }

    /**
     * address
     */
    @Mapper(componentModel = "spring")
    interface AddressModule {
        AddressModule INSTANCE = Mappers.getMapper(AddressModule.class);

        DeliveryAddressDto toDto(DeliveryAddress deliveryAddress);
        List<DeliveryAddressDto> toDtoList(List<DeliveryAddress> deliveryAddressList);
    }

}
